/*
 * Copyright (c) 2019. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
 * Morbi non lorem porttitor neque feugiat blandit. Ut vitae ipsum eget quam lacinia accumsan.
 * Etiam sed turpis ac ipsum condimentum fringilla. Maecenas magna.
 * Proin dapibus sapien vel ante. Aliquam erat volutpat. Pellentesque sagittis ligula eget metus.
 * Vestibulum commodo. Ut rhoncus gravida arcu.
 */

package com.darly.std.math;


import java.util.Random;

/**
 * Description TODO: 超大数据线程计算。
 * Package com.darly.std.queue
 *
 * @author zhangyuhui
 * Date 2019/7/30 11:48

 */
public class MathLibRunnable implements Runnable {

    private boolean isTest = false;

    public MathLibRunnable(boolean isTest){
        this.isTest = isTest;
    }

    @Override
    public void run() {
        int nub = 10000;
        if (isTest){
            int test[] = {8, 5, 3, 2, 4};
            MathLib.On2(test,isTest);
            int test1[] = {8, 5, 3, 2, 4};
            MathLib.SelectOn2(test1,isTest);
            int test2[] = {8, 5, 3, 2, 4};
            MathLib.InsertOn2(test2,isTest);
            int test3[] = {8, 5, 3, 2, 4};
            MathLib.ThorOnLogN(test3,isTest);
        }else{
            int arr[] = new int[nub];
            int arr1[] = new int[nub];
            int arr2[] = new int[nub];
            int arr3[] = new int[nub];
            for (int key = 0;key < nub;key++){
                arr[key]  = new Random().nextInt(nub);
                arr1[key]  = new Random().nextInt(nub);
                arr2[key]  = new Random().nextInt(nub);
                arr3[key]  = new Random().nextInt(nub);
            }
            MathLib.On2(arr,isTest);
            MathLib.SelectOn2(arr1,isTest);
            MathLib.InsertOn2(arr2,isTest);
            MathLib.ThorOnLogN(arr3,isTest);
        }

    }
}
